package com.cn.boot.student.controller.student.likeAndCollect;

import com.cn.boot.student.entity.WordLikeRelationEntity;
import com.cn.boot.student.service.student.IWordLikeService;
import com.cn.boot.student.util.CommonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 点赞控制器
 */
@RestController
@RequestMapping("/admin/word")
@Api(tags = "单词点赞接口")
public class LikeController {
    @Autowired
    private IWordLikeService iWordLikeService;

    /**
     * 收藏
     * @param wordLikeRelationEntity
     * @return
     */
    @PostMapping("/like")
    @ApiOperation(value = "单词点赞")
    public CommonResult like(WordLikeRelationEntity wordLikeRelationEntity){
        return iWordLikeService.like(wordLikeRelationEntity);
    }

    /**
     * 取消收藏
     * @param wordLikeRelationEntity
     * @return
     */
    @PostMapping("/delLike")
    @ApiOperation(value = "取消点赞")
    public CommonResult delLike(WordLikeRelationEntity wordLikeRelationEntity){
        return iWordLikeService.delLike(wordLikeRelationEntity);
    }
    /**
     * 判断用户是否已点赞
     */
//    @PostMapping("/isCollected")
//    @ApiOperation(value = "判断用户是否已点赞")
//    public CommonResult isLike(WordLikeRelationEntity wordLikeRelationEntity){
//        return iWordLikeService.isLike(wordLikeRelationEntity);
//    }
}
